Closed
Conversation
Contributor
…to check permission
Contributor
Author
|
|
Contributor
Author
|
|
There was a problem hiding this comment.
Pull Request Overview
Refactors front-end permission handling to use roleCode-based access rules, dynamically registers/unregisters routes at runtime, and adjusts router initialization and 404 handling.
- Introduces dynamic add/remove of routes using Vue Router’s remove functions to support restore on logout.
- Adds roleCode-based filtering for front-end permissions with an optional strict mode toggle.
- Updates router initialization to start with default routes only and adds a proper 404 catch-all component.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/route/constant.ts | Adds typed 404 route with a catch-all path and component. |
| src/store/modules/user.ts | Simplifies roles and removes persist-time route init hook (handled in guard now). |
| src/store/modules/permission.ts | Registers routes dynamically and provides a robust restore mechanism using remove functions. |
| src/store/modules/permission-fe.ts | Rewrites FE permission filtering based on roleCode and dynamic route registration/restoration. |
| src/router/modules/homepage.ts | Moves root redirect into homepage module. |
| src/router/index.ts | Initializes router with default routes only and exposes whitelist paths. |
| src/permission.ts | Updates navigation guard to build routes once per session and use new whitelist/restore logic. |
| src/layouts/components/MenuContent.vue | Tightens menu filter to require a title and improves default prop typing. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
permission-fe用例roleCode权限处理restore已删除的路由roleCode判断规则📝 更新日志
fix!: 前端权限控制 移除路由
name作为roleCode本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单